<template>
  <div class="show">
    <button @click="isShow = !isShow">
      {{ msg }}
    </button>
    <div class="box" v-show="isShow"></div>
  </div>
</template>

<script>
export default {
  name: 'show',
  data() {
    return {
      msg: '隐藏/显示',
      isShow: true
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.show {
  width: 500px;
  margin: 0 auto;
  button {
    width: 100px;
    height: 50px;
    color: #000;
  }
  .box {
    width: 200px;
    height: 200px;
    margin: 100px auto;
    background-color: #f00;
  }
}
</style>
